module Fighter {
	/**
	 * 子弹父类---刘伟 
	 * */
	export class BulletObject extends egret.Bitmap {
		public constructor(blt_type: string) {
			super();
			this.TypeOfBlt = blt_type;
			this.addEventListener(egret.Event.ADDED_TO_STAGE, this.addToStage, this);
			this.addEventListener(egret.Event.REMOVED_FROM_STAGE, this.removeFromStage, this);
		}
		/**子弹生命值 */
		public Hp: number = 1;
		/**子弹类别 */
		public TypeOfBlt: string;
		/**子弹初始位置 */
		public startPosition: egret.Point = new egret.Point();	
		public m_panel;
		/**子弹加入舞台 */
		protected addToStage(panel ) {
			this.texture = RES.getRes("b1_png");
			this.flightPath();
			this.m_panel=panel;
			this.addEventListener(egret.Event.ENTER_FRAME,this.gameUpdateView,this);
		}
		/**每帧监听 */
		protected gameUpdateView()
		{
			this.outOfStage();
		}
		/**子弹离开舞台 */
		protected removeFromStage(evt: egret.Event) {
			this.Hp = 1;
			//GamePools.instance.reclaimBlt(this);
			this.removeEventListener(egret.Event.ENTER_FRAME,this.gameUpdateView,this);
			
		}

		/**子弹飞行轨迹 */
		protected flightPath() {
			egret.Tween.removeTweens(this);
			egret.Tween.get(this).to({ y: -10 }, 2000);
		}
		/**子弹越界 */
		protected outOfStage() {
			if (this.x > egret.MainContext.instance.stage.stageWidth || this.x < 0
				|| this.y > egret.MainContext.instance.stage.stageHeight || this.y < 0) {
				this.Hp = 0;
			}
		}

	}
}